
$(function () {
    //长宽设置
    var windowW=parseInt($(window).width());//屏幕的宽度
    var windowH=parseInt($(window).height());//屏幕的宽度
    var proportion=2160/3920;//图片高宽比例
    //$('.footer').css({'width':windowW+'px'});
    $('.container').css({'height':windowW*proportion+'px'});
    //$('.container').css({'height':windowH+'px'});

    //时间代码
    var timeobj=document.getElementById('time');
    var dateobj=document.getElementById('date');
    function getDate(){
        var sw=new Date();
        var year=sw.getFullYear();
        var month=sw.getMonth()+1;
        var day=sw.getDate();
        var hour=sw.getHours();
        if(hour<10){
            hour='0'+hour
        }
        var mintune=sw.getMinutes();
        if(mintune<10){
            mintune='0'+mintune
        }
        var newDate=year+'-'+month+'-'+day;
        dateobj.innerHTML=newDate;
        var newTime=hour+':'+mintune;
        timeobj.innerHTML=newTime;

        //时间差代码
        var moreDay=document.getElementById('run')
        var date1 = new Date('2017/10/06');
        var date2 =sw;
        var time1 = date1.getTime(),time2 = date2.getTime();
        var total = (time2 - time1)/1000;
        var day = parseInt(total/(24*60*60));//计算整数天数
        moreDay.innerHTML=day;
    }
    getDate();
    setInterval(function(){
        getDate();
    },1000);
});

